<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>缺陷管理</title>
    <link rel="stylesheet" href="/webjars/layui/2.5.5/css/layui.css"  media="all">
</head>
<body>
<form class="layui-form" action="">
    <div class="layui-form-item" style="margin-top: 50px">
        <div class="layui-inline">
            <label class="layui-form-label">任务编号</label>
            <div class="layui-input-inline">
                <input type="tel" name="taskId" id="taskId" lay-verify="required|phone" autocomplete="off" class="layui-input">
            </div>
            <label class="layui-form-label">线路编号</label>
            <div class="layui-input-inline">
                <input type="tel" name="lineCode" id="lineCode" lay-verify="required|phone" autocomplete="off" class="layui-input">
            </div>
            <label class="layui-form-label">缺陷类型</label>
            <div class="layui-input-inline">
                <select  id="service2" name="bugType" lay-verify="required"  class="select">
                    <option value=" ">--请选择--</option>
                </select>
            </div>
            <label class="layui-form-label">缺陷级别</label>
            <div class="layui-input-inline">
                <select  id="service" name="bugLevel" lay-verify="required"  class="select">
                    <option value=" ">--请选择--</option>
                </select>
            </div>
        </div>
    </div>
    <div class="layui-form-item" style="margin-top: 10px">
        <div class="layui-inline">
            <label class="layui-form-label">发现时间：</label>
            <div class="layui-input-inline" style="width: 180px">
                <input type="text" class="layui-input"  name="discoverTime"  placeholder="" id="kaishi">
            </div>
            <div class="layui-form-mid">————</div>
            <div class="layui-input-inline" style="width: 180px">
                <input type="text" class="layui-input"  name="discoverTime" placeholder="" id="jeiShu">
            </div>
            <label class="layui-form-label">下发时间：</label>
            <div class="layui-input-inline" style="width: 180px">
                <input type="text" class="layui-input" name="creationTime"  placeholder="" id="kaishi1">
            </div>
            <div class="layui-form-mid">————</div>
            <div class="layui-input-inline" style="width: 180px">
                <input type="text" class="layui-input"  name="creationTime" placeholder="" id="jeiShu1">
            </div>
            <button type="button" class="layui-btn" style="margin-left: 80px" onclick="ChaXun()">查询</button>
        </div>
    </div>
</form>
    <div class="layui-container" style="width:100%;margin-top:50px ">
        <table id="AttTb" lay-filter="AttTb" lay-data="AttTb"></table>
    </div>
    <script src="/webjars/layui/2.5.5/layui.js" charset="utf-8"></script>
    <script>
        layui.use(["jquery","layer","form","table","laydate"],function () {
            let form = layui.form;
            let $ = layui.$;
            let table = layui.table;
            let laydate = layui.laydate;
            table.render({
                id: "AttTb",
                elem: "#AttTb",
                url: "/XunJianQueCha/QueXianCha2",
                cols: [
                    [
                        {field:'id',  title: 'ID',sort: true}
                        ,{field: 'lineCode',title: '所属线路',hide: true}
                        ,{field:'taskId', title: '任务编号'}
                        ,{field:'lineCode', title: '线路编号'}
                        ,{field: 'poleCode',title:'杆塔编号'}
                        ,{field: 'bugLevel',title:'缺陷级别',templet: function(d){
                            return d.bugLevel==25?"一般":d.bugLevel==26?"紧急":d.bugLevel==27?"严重":"";
                        }}
                        ,{field: 'bugType',title:'缺陷类型',templet: function(d){
                            return d.bugType==16?"叉梁断裂1":d.bugType==17?"拦河线断裂":d.bugType==18?"绝缘子爆破":d.bugType==19?"杆塔倾斜"
                                :d.bugType==20?"横杠弯曲下垂":d.bugType==21?"瓷瓶破裂":d.bugType==22?"其他":d.bugType==39?"吊杆变形1":d.bugType==42?"风化1":"";
                        }}
                        ,{field: 'discovererName',title:'发现人'}
                        ,{field: 'discoverTime',title:'发现时间'}
                        ,{field: 'createBy',title:'下发人'}
                        ,{field: 'creationTime',title:'下发时间'}
                        ,{field: 'intactRate',title:'完好率'}
                        ,{field: 'bugDesc',title:'缺陷描述'}
                    ]
                ],
                page: {
                    limit: 4,
                    limits: [4, 8, 12]
                }

            })
            laydate.render({
                elem: '#kaishi'
            });
            laydate.render({
                elem: '#jeiShu'
            });
            laydate.render({
                elem: '#kaishi1'
            });
            laydate.render({
                elem: '#jeiShu1'
            });

            /*缺陷级别下拉框赋值*/
            $.ajax({
                url:"/XunJianZhiXing/ChaQueJi",
                dataType: 'json',
                success: function(data) {
                    if (data!== null) {
                        $("#service").empty();
                        $("#service").append(new Option("--请选择--", " "));
                        $.each(data, function(index, item) {
                            $('#service').append(new Option(item.configName,item.id));
                        });
                    } else {
                        $("#service").append(new Option("暂无数据", ""));
                    }
                    //重新渲染
                    form.render("select");
                }
            })

            /*缺陷类型下拉框赋值*/
            $.ajax({
                url:"/XunJianZhiXing/QueLeiXia",
                dataType: 'json',
                success: function(data) {
                    if (data!== null) {
                        $("#service2").empty();
                        $("#service2").append(new Option("--请选择--", " "));
                        $.each(data, function(index, item) {
                            $('#service2').append(new Option(item.configName,item.id));
                        });
                    } else {
                        $("#service2").append(new Option("暂无数据", ""));
                    }
                    //重新渲染
                    form.render("select");
                }
            })
        })

        function ChaXun() {
            layui.use(['form','layedit', 'laydate','table','jquery'], function(){
                var $ = layui.$;
                let taskId=$("#taskId").val();
                let lineCode=$("#lineCode").val();
                let bugLevel=$("#service").val();
                let bugType=$("#service2").val();
                let kai=$("#kaishi").val();
                let jie=$("#jeiShu").val();
                let kai1=$("#kaishi1").val();
                let jie1=$("#jeiShu1").val();
                console.log(jie1)
                console.log(kai1)
                let where={taskId,lineCode,bugLevel,bugType,kai,jie,kai1,jie1,curr:1};
                layui.table.reload("AttTb",{where});
            });
        }
    </script>
</body>
</html>